<?php defined('IN_ADMIN') or exit('No permission resources.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="addbg">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>添加内容</title>
  <link href="__PUBLIC__/css/admin/reset.css" rel="stylesheet" type="text/css">
  <link href="__PUBLIC__/css/admin/zh-cn-system.css" rel="stylesheet" type="text/css">
  <link href="__PUBLIC__/css/admin/table_form.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/admin/style/zh-cn-styles1.css" title="styles1" media="screen">
  <link rel="alternate stylesheet" type="text/css" href="__PUBLIC__/css/admin/style/zh-cn-styles2.css" title="styles2" media="screen">
  <link rel="alternate stylesheet" type="text/css" href="__PUBLIC__/css/admin/style/zh-cn-styles3.css" title="styles3" media="screen">
  <link rel="alternate stylesheet" type="text/css" href="__PUBLIC__/css/admin/style/zh-cn-styles4.css" title="styles4" media="screen">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/JSCal/jscal2.css">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/JSCal/win2k/win2k.css">
  <script type="text/javascript" src="__PUBLIC__/js/admin/jquery.min.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/admin/jquery.cookie.js"></script>
  <script language="javascript" type="text/javascript" src="__PUBLIC__/js/admin/cookie.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/admin/styleswitch.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/admin/admin_common.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/JSCal/jscal2.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/JSCal/lang/cn.js"></script>
  <script src="__PUBLIC__/js/admin/jquery.artDialog.source.js?skin=default"></script>
  <script src="__PUBLIC__/js/admin/plugins/iframeTools.source.js"></script>
  <script language="javascript" type="text/javascript" src="__PUBLIC__/js/admin/content_add.js" charset="UTF-8"></script>
  <script language="javascript" type="text/javascript" src="__PUBLIC__/js/admin/formvalidator.js" charset="UTF-8"></script>
  <script language="javascript" type="text/javascript" src="__PUBLIC__/js/admin/formvalidatorregex.js" charset="UTF-8"></script>
  <script type="text/javascript" src="__PUBLIC__/js/ckeditor/ckeditor.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/admin/attachupload.js"></script>
  <script type="text/javascript">var catid=<?php echo $catid; ?></script>
</head>
<body>
  <form name="myform" id="myform" action="" method="post" enctype="multipart/form-data">
    <input type="hidden" name="info[typeid]" value="1" />
    <input type="hidden" name="modelid" value="<?php echo $category['modelid']; ?>">
    <div class="addContent">
      <div class="crumbs">当前位置：内容 > 内容发布管理 > 添加内容</div>
      <div class="col-right">
        <div class="col-1">
          <div class="content pad-6">
            <h6>缩略图</h6>
            <div class="upload-pic img-wrap">
              <input type="hidden" name="info[thumb]" id="thumb" value="">
              <a href="javascript:void(0);" onclick="attachupload('thumb_images', '附件上传','thumb',thumb_images,'1,jpg|jpeg|png|gif,1','image','<?php echo U("Upfile/upload"); ?>');return false;">
                <img src="__PUBLIC__/images/admin/admin_upload_thumb.png" id="thumb_preview" width="135" height="113" style="cursor:hand">
              </a>
              <input type="button" style="width: 66px;" class="button" onclick="crop_cut_thumb($('#thumb').val());return false;" value="裁切图片"><input type="button" style="width: 66px;" class="button" onclick="$('#thumb_preview').attr('src','__PUBLIC__/images/admin/admin_upload_thumb.png');$('#thumb').val('');return false;" value="取消图片">
              <script type="text/javascript">
              function crop_cut_thumb(id){
                if (id=='') { alert('请先上传缩略图');return false;}
                window.top.art.dialog({title:'裁切图片', id:'crop', iframe:'index.php?m=content&c=content&a=public_crop&module=content&catid='+catid+'&picurl='+encodeURIComponent(id)+'&input=thumb&preview=thumb_preview', width:'680px', height:'480px'},  function(){var d = window.top.art.dialog({id:'crop'}).data.iframe;d.uploadfile();return false;}, function(){window.top.art.dialog({id:'crop'}).close()});
              };
              </script>
            </div> 
            <h6>相关文章</h6>
            <input type="hidden" name="info[relation]" id="relation" value="" style="50">
            <ul class="list-dot" id="relation_text"></ul>
            <div>
              <input type="button" value="添加相关" onclick="omnipotent('selectid','__CONTROLLER__/public_relationlist?catid=<?php echo $catid; ?>','添加相关文章',1)" class="button" style="width:66px;">
              <!-- <span class="edit_content" style="display: none;">
                <input type="button" value="显示已有" onclick="show_relation(1,0)" class="button" style="width:66px;">
              </span> -->
            </div> 
            <h6> 发布时间</h6>
            <input type="text" name="info[inputtime]" id="inputtime" value="" size="21" class="date input-text" readonly="">&nbsp;<script type="text/javascript">
            Calendar.setup({
              weekNumbers: true,
              inputField : "inputtime",
              trigger    : "inputtime",
              dateFormat: "%Y-%m-%d %H:%M:%S",
              showTime: true,
              minuteStep: 1,
              onSelect   : function() {this.hide();}
            });
            </script> 
            <h6> 转向链接</h6>
            <input type="hidden" name="info[islink]" value="0">
            <input type="text" name="linkurl" id="linkurl" value="" size="25" maxlength="255" disabled="disabled" class="input-text">
            <input name="info[islink]" type="checkbox" id="islink" value="1" onclick="ruselinkurl();">
            <font color="red">转向链接</font>
            <h6> 允许评论</h6>
            <label class="ib" style="width:88px"><input type="radio" name="info[allow_comment]" id="allow_comment_1" checked="" value="1"> 允许评论</label><label class="ib" style="width:88px"><input type="radio" name="info[allow_comment]" id="allow_comment_0" value="0"> 不允许评论</label> 
            <h6>状态</h6>
            <span class="ib" style="width:90px"><label><input type="radio" name="info[status]" value="99" checked=""> 发布 </label></span>
            <label><input type="radio" name="info[status]" value="1"> 审核 </label>                      
          </div>
        </div>
      </div>
      <a title="展开与关闭" class="r-close" hidefocus="hidefocus" style="outline-style: none; outline-width: medium;" id="RopenClose" href="javascript:;"><span class="hidden">展开</span></a>
      <div class="col-auto">
        <div class="col-1">
          <div class="content pad-6">
            <table width="100%" cellspacing="0" class="table_form">
              <tbody>
                <tr>
                  <th width="80"> <font color="red">*</font> 栏目   </th>
                  <td>
                    <input type="hidden" name="info[catid]" value="<?php echo $category['id']; ?>"><?php echo $category['catname']; ?> <a href="javascript:;" onclick="omnipotent('selectid','<?php echo U('Content/add_othors') ?>','同时发布到其他栏目',1);return false;" style="color:#B5BFBB">[同时发布到其他栏目]</a><ul class="list-dot-othors" id="add_othors_text"></ul>
                  </td>
                </tr>
                <tr>
                  <th width="80"> <font color="red">*</font> 标题   </th>
                  <td>
                    <input type="text" style="width:400px;" name="info[title]" id="title" value="" class="measure-input  input-text" onkeyup="strlen_verify(this, 'title_len', 255);">
                    <!-- onblur="$.post('api.php?op=get_keywords&amp;number=3&amp;sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data &amp;&amp; $('#keywords').val()=='') $('#keywords').val(data); })" 
                    <input type="hidden" name="style_color" id="style_color" value="">
                    <input type="hidden" name="style_font_weight" id="style_font_weight" value=""> -->
                    <input type="button" class="button" id="check_title_alt" value="检测重复" onclick="$.get('__CONTROLLER__/public_check_title?modelid=' + <?php echo $category['modelid']; ?>, {data:$('#title').val()}, function(data){if(data=='1') {$('#check_title_alt').val('标题重复').css('background-color','#FFCC66');} else if(data=='0') {$('#check_title_alt').val('标题不重复').css('background-color','#F8FFE1')}})" style="width:73px;"></span>还可输入<b><span id="title_len">255</span></b> 个字符  
                    <!-- <img src="http://localhost/sck/statics/images/icon/colour.png" width="15" height="16" onclick="colorpicker('title_colorpanel','set_title_color');" style="cursor:hand"> 
                    <img src="http://localhost/sck/statics/images/icon/bold.png" width="10" height="10" onclick="input_font_bold()" style="cursor:hand"> <span id="title_colorpanel" style="position:absolute;" class="colorpanel"> -->
                  </td>
                </tr>
                <tr>
                  <th width="80">关键词</th>
                  <td><input type="text" name="info[keywords]" id="keywords" value="" style="width:280px" class="input-text">  多关键词之间用空格或者“,”隔开</td>
                </tr>
                <tr>
                  <th width="80">来源</th>
                  <td>
                    <input type="text" name="info[copyfrom]" value="" style="width: 400px;" class="input-text">
                    <!-- <select name="copyfrom_data"><option value="0" selected="">≡请选择≡</option></select> -->
                  </td>
                </tr>
                <tr>
                  <th width="80"><font color="red">*</font>摘要</th>
                  <td>
                    <textarea name="info[description]" id="description" style="width:98%;height:46px;" onkeyup="strlen_verify(this, 'description_len', 255)"></textarea>还可输入<b><span id="description_len">255</span></b> 个字符  
                  </td>
                </tr>
                <tr>
                  <th width="80"><font color="red">*</font>内容</th>
                  <td>
                    <textarea name="info[content]" id="content" class="ckeditor"></textarea>
                  </td>
                </tr>
                <tr>
                  <th width="80"> 推荐位   </th>
                  <td><?php echo $posidstr; ?></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="fixed-bottom">
      <div class="fixed-but text-c">
        <div class="button"><input value="保存后关闭" type="submit" name="dosubmit" class="cu" style="width:130px;" onclick="refersh_window()"></div>
        <div class="button"><input value="保存后继续添加" type="submit" name="dosubmit_continue" class="cu" style="width:145px;" title="Alt+X" onclick="refersh_window()"></div>
        <div class="button"><input value="关闭" type="button" name="close" onclick="refersh_window();close_window();" class="cu" style="width:70px;"></div>
      </div>
    </div>
  </form>
  <script type="text/javascript">
  CKEDITOR.replace( 'content', {
    // filebrowserBrowseUrl: '__MODULE__/Upfile/upload',
    filebrowserUploadUrl: '__MODULE__/Upfile/upload'
  });
  var openClose = $("#RopenClose"), rh = $(".addContent .col-auto").height(),colRight = $(".addContent .col-right"),valClose = getcookie('openClose');
  $(function(){
    if(valClose==1){
      colRight.hide();
      openClose.addClass("r-open");
      openClose.removeClass("r-close");
    }else{
      colRight.show();
    }
    openClose.height(rh);
    $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){
      window.top.art.dialog({id:'check_content_id',content:msg,lock:true,width:'200',height:'50'},function(){
        $(obj).focus();
        boxid = $(obj).attr('id');
        if($('#'+boxid).attr('boxid')!=undefined) {
          check_content(boxid);
        }
      })}
    });
    
    $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
    $("#title").formValidator({onshow:"",onfocus:"请输入标题"}).inputValidator({min:1,max:255,onerror:"标题不能为空"});

    /*
    * 加载禁用外边链接
    */
    $('#linkurl').attr('disabled',true);
    $('#islink').attr('checked',false);
    $('.edit_content').hide();
    // jQuery(document).bind('keydown', 'Alt+x', function (){close_window();});
  })
  self.moveTo(0, 0);
  function refersh_window() {
    setcookie('refersh_time', 1);
  }
  openClose.click(function (){
    if(colRight.css("display")=="none"){
      setcookie('openClose',0,1);
      openClose.addClass("r-close");
      openClose.removeClass("r-open");
      colRight.show();
    }else{
      openClose.addClass("r-open");
      openClose.removeClass("r-close");
      colRight.hide();
      setcookie('openClose',1,1);
    }
  });
  </script>
</body>
</html>